#pragma once

#include "SceneSubsystem.h"
#include "Scene/InputComponent.h"
#include "InputComponentManager.m.h"


class RInputComponent;

//输入组件管理器
RCLASS(ExtraHeader="Scene/InputComponent.h")
class WHENGINE_API RInputComponentManager :public RSceneSubsystem
{
    ROBJECT

public:

    void RegisterComponent(TSharedObjectPtr<RInputComponent> InComponent);
    void UnregisterComponent(TSharedObjectPtr<RInputComponent> InComponent);


    bool OnViewportMouseButtonPressed(const SMouseButtonEvent& InMouseEvent,TSharedObjectPtr<RViewportWidget> InViewport);
    bool OnViewportMouseButtonReleased(const SMouseButtonEvent& InMouseEvent,TSharedObjectPtr<RViewportWidget> InViewport);
    bool OnViewportMouseMoved(const SMouseButtonEvent& InMouseEvent,TSharedObjectPtr<RViewportWidget> InViewport);
    bool ProcessKeyboardEvent(const SKeyboardEvent& BoardkeyEvent,TSharedObjectPtr<RViewportWidget> InViewport);


protected:
    //所有注册的输入组件
    RFIELD()
    TVector<TSharedObjectPtr<RInputComponent>> InputComponents;


};